package com.slkj.filter;


import com.slkj.util.RequestResponseBox;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter(filterName = "RequestResponseFilter", urlPatterns = {"/*"})
public class RequestResponseFilter implements Filter {


    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

        request.setCharacterEncoding("utf-8");
        RequestResponseBox.setRequest((HttpServletRequest) request);
        RequestResponseBox.setResponse((HttpServletResponse) response);
        chain.doFilter(request, response);
    }

}
